/**
 * 
 */
package com.point.business.tags;

import java.io.StringWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

import com.point.business.database.model.User;

/**
 * @author Ilija Trajkoski
 * 
 */
public class CanSearchNOTag extends TagSupport {

	private static final long serialVersionUID = 5259094061007223395L;
	StringWriter sw = new StringWriter();

	@Override
	public int doStartTag() throws JspException {
		HttpServletRequest request = (HttpServletRequest) pageContext
				.getRequest();
		HttpSession session = request.getSession();
		User user = (User) session.getAttribute("user");
		if (user != null) {
			if (user.isCanDoNO()) {
				return EVAL_BODY_INCLUDE;
			} else {
				return SKIP_BODY;
			}
		} else {
			return SKIP_BODY;
		}
	}
}
